from rest_framework import serializers
from goods.models import GoodsChannel,GoodsChannelGroup,GoodsCategory

# class GoodsChannelGroupSerializer(serializers.ModelSerializer):
#     name=serializers.StringRelatedField(read_only=True,many=True)
#     class Meta:
#         model=GoodsChannelGroup
#         fields="__all__"


class GoodsChnnelsViewSerializers(serializers.ModelSerializer):

    group=serializers.StringRelatedField(read_only=True)
    group_id=serializers.IntegerField()

    category=serializers.StringRelatedField(read_only=True)
    category_id=serializers.IntegerField()

    class Meta:
        model=GoodsChannel
        fields="__all__"


class ChnnelsCategoriesSerializer(serializers.ModelSerializer):

    class Meta:
        model=GoodsCategory
        fields=("id","name")

class ChnnelsTypeSerializer(serializers.ModelSerializer):
    class Meta:
        model=GoodsChannelGroup
        fields = "__all__"